<form method="post" name="show_customers_form" id="show_customers_form" action="">
<table class="Centered List" border="0">
	<tr class="HeaderTr">
		<td colspan="3" class="LeftAlign"><b><?php echo $cust_category;?></b></td>
		<td colspan="3" class="RightAlign">Search: <input type="text" name="q" /></td>
	</tr>
	<tr class="HeaderTr">
		<th width="15px"><input type="checkbox" name="" onclick="select_all(this);" /></th>
		<th class="LeftAlign">Name</th>
		<th width="10%">City</th>
		<th width="10%">Postcode</th>
		<th width="15%">Telephone</th>
		<th class="LeftAlign" width="25%">Email</th>
	</tr>
	<?php if(!empty($customers)){
			foreach ($customers as $key=>$customer){
	?>
	<tr class="<?php echo($key%2 == 0 ? 'row0' : 'row1'); ?>">
		<td><input type="checkbox" name="customers[]" value="<?php echo $customer->id;?>" /></td>
		<td class="LeftAlign"><a href="?option=<?php echo COMPONENT_NAME;?>&page=customers&action=edit&cid=<?php echo $customer->id;?>"><?php echo $customer->title." ".$customer->firstname." ".$customer->surname;?></a></td>
		<td><?php echo $customer->city;?></td>
		<td><?php echo $customer->postcode;?></td>
		<td><?php echo $customer->telephone;?></td>
		<td class="LeftAlign"><a href="mailto:<?php echo $customer->email;?>"><?php echo $customer->email;?></a></td>
	</tr>
	<?php }
	}?>
	<tr class="HeaderTr">
		<td colspan="6" class="LeftAlign">
			<?php if( $paginate['pg_no'] == 1 ){?>
				&lt;&lt;Start&nbsp;&nbsp;&lt;Previous&nbsp;
			<?php }else{?>
				<a href="?option=<?php echo COMPONENT_NAME;?>&page=<?php echo $_GET['page']?>&pg_no=1&limit=<?php echo $paginate['limit'];?>">&lt;&lt;Start</a>&nbsp;&nbsp;<a href="?option=<?php echo COMPONENT_NAME;?>&page=<?php echo $_GET['page']?>&pg_no=<?php echo $paginate['prev'];?>&limit=<?php echo $paginate['limit'];?>">&lt;Previous</a>
			<?php }?>
			<?php for($i = 1; $i <= $paginate['max_page']; $i++){?>
				<?php if( $i == $paginate['pg_no'] ){?>
					<?php echo $i;?>
				<?php }else{?>
					&nbsp;&nbsp;<a href="?option=<?php echo COMPONENT_NAME;?>&page=<?php echo $_GET['page']?>&pg_no=<?php echo $i;?>&limit=<?php echo $paginate['limit'];?>"><?php echo $i;?></a>&nbsp;&nbsp;
				<?php }?>
			<?php }?>
			<?php if($paginate['pg_no'] == $paginate['max_page']){?>
				&nbsp;Next&gt;&nbsp;&nbsp;End&gt;&gt;
			<?php }else{?>
				<a href="?option=<?php echo COMPONENT_NAME;?>&page=<?php echo $_GET['page']?>&pg_no=<?php echo $paginate['next'];?>&limit=<?php echo $paginate['limit'];?>">Next&gt;</a>&nbsp;&nbsp;<a href="?option=<?php echo COMPONENT_NAME;?>&page=<?php echo $_GET['page']?>&pg_no=<?php echo $paginate['max_page'];?>&limit=<?php echo $paginate['limit'];?>">End&gt;&gt;</a>
			<?php }?>
		</td>
	</tr>
	<tr>
	  	<td align="center" colspan="6" class="RowsDisplayTd">
	  		Display 
	  		<select onchange="document.show_customers_form.submit()" size="1" name="limit">
				<option value="5" <?php echo ($limit == 5 ? 'selected = "selected"' : ''); ?>>5</option>
				<option value="10" <?php echo ($limit == 10 ? 'selected = "selected"' : ''); ?>>10</option>
				<option value="15" <?php echo ($limit == 15 ? 'selected = "selected"' : ''); ?>>15</option>
				<option value="20" <?php echo ($limit == 20 ? 'selected = "selected"' : ''); ?>>20</option>
				<option value="25" <?php echo ($limit == 25 ? 'selected = "selected"' : ''); ?>>25</option>
				<option value="30" <?php echo ($limit == 30 ? 'selected = "selected"' : ( empty($limit) ? 'selected = "selected"' : '' )); ?>>30</option>
				<option value="50" <?php echo ($limit == 50 ? 'selected = "selected"' : ''); ?>>50</option>
			</select>
			rows
	  	</td>
	</tr>
</table>
<input type="hidden" id="form" name="form" value="search_customers">
</form>
<?php $KToolBar->addLink('<a href="?option='.COMPONENT_NAME.'&page=customers&action=new"><img border="0" alt="New" src="images/new_f2.png"/><br />New</a>');?>
<?php $KToolBar->addLink('<a href="#" onclick="delete_selected(\'show_customers_form\')"><img border="0" alt="Delete" src="images/delete_f2.png"/><br />Delete</a>');?>

<script type="text/javascript">
function delete_customers(form){
	$('input[name=form]').val("delete_customers");
	document.getElementById(form).submit();
}
</script>